package com.study.meng.bigevent.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.Default;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @TableName article
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Article {
    @NotNull(message = "文章ID不能为空", groups = {Article.update.class})
    private Integer id;
    @NotEmpty(message = "文章标题不能为空")
    private String title;
    @NotEmpty(message = "文章摘要不能为空")
    private String content;
    @NotEmpty(message = "文章封面不能为空")
    private String coverImg;
    @NotEmpty(message = "文章状态不能为空")
    private String state;
    @NotNull(message = "分类ID不能为空")
    private Integer categoryId;

    private Integer createUser;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    public interface update extends Default {
    }

    public interface add extends Default {
    }
}